﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using appLibrary;

namespace appDeskSistAcademico
{
    public partial class FrmMain : Form
    {
        public string user { set; get; }
        public int idUser { set; get; }
        public int idRole { set; get; }
        public string roleName { set; get; }

        public FrmMain()
        {
            InitializeComponent();
        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            
           tssDate.Text = tssDate.Text + DateTime.Now.ToString("yyyy-MM-dd");
           tssUser.Text = tssUser.Text+user;
            try
            {
                String strRelease = "";
                ClassRead.getPrefDinamico("config.xml", ref strRelease, "last_release", user);
                tssLastRelease.Text =tssLastRelease.Text+ strRelease;
                ViewQueries viewQueries = new ViewQueries();
                DataSet dts = viewQueries.getSPQueries("seguridad.sp_queries__role_description_by_code", null, idRole);
                if (dts != null && dts.Tables != null && dts.Tables[0].Rows.Count > 0)
                    tssRole.Text = tssRole.Text + dts.Tables[0].Rows[0][0].ToString();


                this.roleName = tssRole.Text;
            }
            catch (Exception ex)
            {
                Log.eLog(user, "Error al intentar recuperar el nombre del rol:" + ex.ToString());
            }

            this.roleName = tssRole.Text;
        }

        private void reporteSemanalToolStripMenuItem_Click(object sender, EventArgs e)
        {
           // gpbCreateRpteWeek.Visible = true;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            //gpbCreateRpteWeek.Visible = false;
        }

        private void btnAcepp_Click(object sender, EventArgs e)
        {

        }

        private void reporteDiarioToolStripMenuItem_Click(object sender, EventArgs e)
        {
           /* FrmReportDailyManagement frmReportDailyManagement = new FrmReportDailyManagement();
            frmReportDailyManagement.MdiParent = this;
            frmReportDailyManagement.user = user;
            frmReportDailyManagement.idUser=idUser;
            frmReportDailyManagement.idRole = idRole;

            frmReportDailyManagement.Show();*/

        }

        private void roturaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /*FrmProgramMine frmProgramMine = new FrmProgramMine();
            frmProgramMine.MdiParent = this;
            frmProgramMine.Show();*/
        }

        private void plantaToolStripMenuItem_Click(object sender, EventArgs e)
        {
           /* FrmProgramPlant frmProgramPant = new FrmProgramPlant();
            frmProgramPant.MdiParent = this;
            frmProgramPant.Show();*/

        }

        private void registroToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void mnuQReportDaily_Click(object sender, EventArgs e)
        {
           /* FrmQueriesReportDaily frmQueriesReportDaily = new FrmQueriesReportDaily();
            frmQueriesReportDaily.MdiParent = this;
            frmQueriesReportDaily.Show();*/
        }

        private void tlspbRDailyReport_Click(object sender, EventArgs e)
        {
            reporteDiarioToolStripMenuItem_Click(sender, e);
        }

        private void tlspbQDailyReport_Click(object sender, EventArgs e)
        {
            mnuQReportDaily_Click(sender, e);
        }

        private void FrmMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void stockMinaToolStripMenuItem_Click(object sender, EventArgs e)
        {
           /* FrmControlStock frmControlStock = new FrmControlStock();
            frmControlStock.MdiParent = this;
            frmControlStock.Show();*/
        }

        private void tspmIndicator_Click(object sender, EventArgs e)
        {
           /* FrmGraphic frmGraphic = new FrmGraphic();
            frmGraphic.MdiParent = this;
            frmGraphic.Show();*/
        }

        private void tlspbGDailyReport_Click(object sender, EventArgs e)
        {
            tspmIndicator_Click(sender, e);
        }

        private void timer1_Tick(object sender, EventArgs e)
        {

            tssHour.Text = "Hora:" + DateTime.Now.ToString("HH:mm:ss");
        }
    }
}
